import { Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity()
export class User {
    constructor(props?: Partial<User>) {
        Object.assign(this, props);
    }

    @PrimaryColumn()
    public telegramId!: string;

    @ApiProperty({ example: 'tupak', description: 'UserName from telegram' })
    @Column({
        nullable: true,
        unique: true,
    })
    public username!: string;

    @ApiProperty({ example: '21.23.1990', description: 'date registration' })
    @CreateDateColumn({ nullable: true, name: 'created_at', type: 'timestamptz' })
    createdAt!: Date;
}
